Skip to main content
POST
[Deprecated] Chat completions for OpenAI SDK/client usage

Authorizations

Authorization
string
header
required

Send Authorization: Bearer , using an MKA1 API key for automation or an OAuth API access token for a signed-in application. Use a dynamic security callback to refresh OAuth access tokens. Browser session-only operations still require their declared cookie.

Headers

X-On-Behalf-Of
string

Optional external end-user identifier forwarded by the API gateway.

Body

application/json

Request parameters for creating a chat completion. Based on the OpenAI Chat Completions API.

model
string
required

ID of the model to use. You can use provider:model format or just the model name with a default provider.

Minimum string length: 1
messages
object[]
required

A list of messages comprising the conversation so far. At least one message is required.

Minimum array length: 1
tools
object[]

A list of tools the model may call. Use this to provide function definitions the model can invoke.

tool_choice

Controls which (if any) tool is called by the model. 'none' means the model will not call any tool. 'auto' means the model can pick. 'required' forces a tool call.

stream
boolean

If set, partial message deltas will be sent as server-sent events. Note: This field is ignored by the streaming endpoint, used only by OpenAI-compatible client endpoints.

n
integer

How many chat completion choices to generate for each input message. Default is 1.

Required range: 1 <= x <= 9007199254740991
max_tokens
integer | null

The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length. The same setting as max_completion_tokens; if both are sent they must be equal. Null is the same as omitting it.

Required range: 1 <= x <= 9007199254740991
max_completion_tokens
integer | null

An upper bound for the number of tokens that can be generated for a completion. The newer OpenAI name for max_tokens and the same setting; if both are sent they must be equal. Null is the same as omitting it.

Required range: 1 <= x <= 9007199254740991
temperature
number

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

Required range: 0 <= x <= 2
top_p
number

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

Required range: 0 <= x <= 1
frequency_penalty
number

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.

presence_penalty
number

Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.

seed
integer

If specified, the system will make a best effort to sample deterministically. Determinism is not guaranteed, but the same seed should typically return similar results.

Required range: -9007199254740991 <= x <= 9007199254740991
stop

Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.

response_format
object

An object specifying the format that the model must output. Setting to { 'type': 'json_object' } enables JSON mode.

logprobs
boolean

Whether to return log probabilities of the output tokens. If true, returns the log probabilities of each output token returned in the content of message.

top_logprobs
integer

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used.

Required range: 0 <= x <= 20
user
string

A unique identifier representing your end-user. /chat/completions and /chat/completions/stream ignore this value and send the authenticated caller's external user id to the model provider instead. A Batch request line sends its own value.

stream_options
object

Options for streaming response. Only set this when you set stream: true.

parallel_tool_calls
boolean
default:true

Whether to enable parallel function calling during tool use.

reasoning_effort
enum<string> | null

Constrains effort on reasoning for reasoning models. Lower effort results in faster responses and fewer reasoning tokens. Supported values: 'none', 'minimal', 'low', 'medium', 'high', 'xhigh', or null.

Available options:
none,
minimal,
low,
medium,
high,
xhigh

Response

Successful chat completion response. Returns JSON for non-streaming (stream=false) or Server-Sent Events for streaming (stream=true).

Represents a chat completion response from the API

id
string
required

A unique identifier for the chat completion

object
any
required

The object type, always 'chat.completion'

created
integer
required

The Unix timestamp (in seconds) of when the chat completion was created

Required range: -9007199254740991 <= x <= 9007199254740991
model
string
required

The model used for the chat completion

choices
object[]
required

A list of chat completion choices. Can be more than one if n is greater than 1.

usage
object
required

Usage statistics for the completion request

system_fingerprint
string

This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with the seed request parameter to understand when backend changes have been made that might impact determinism.

resolved_model
string

The concrete catalog model that served the completion, after resolving aliases such as "auto" and any failover.

resolved_provider
string

The registry provider key of the model named by resolved_model: the provider that actually served the completion.

resolved_serving_location
string | null

Where the completion was served, as reported by the serving upstream (the x-mka1-serving-location response header) or, failing that, the single location the model's registry card declares. Null when neither is known, which is the case for externally hosted models.